package com.mcc.app.carbonEmission.service.impl;

import java.util.List;

import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mcc.app.carbonEmission.mapper.ReportAssistHanMapper;
import com.mcc.app.carbonEmission.domain.ReportAssistHan;
import com.mcc.app.carbonEmission.service.IReportAssistHanService;

/**
 * 过热蒸汽焓值Service业务层处理
 *
 * @author gxy
 * @date 2025-07-04
 */
@Service
public class ReportAssistHanServiceImpl implements IReportAssistHanService {

    @Autowired
    private ReportAssistHanMapper reportAssistHanMapper;

    /**
     * 查询过热蒸汽焓值
     *
     * @param id 过热蒸汽焓值ID
     * @return 过热蒸汽焓值
     */
    @Override
    public ReportAssistHan selectReportAssistHanById(Long id) {
        return reportAssistHanMapper.selectById(id);
    }

    /**
     * 查询过热蒸汽焓值列表
     *
     * @param reportAssistHan 过热蒸汽焓值
     * @return 过热蒸汽焓值
     */
    @Override
    public List<ReportAssistHan> selectReportAssistHanList(ReportAssistHan reportAssistHan) {
        QueryWrapper queryWrapper = new QueryWrapper();
        if (ObjectUtil.isNotEmpty(reportAssistHan)) {
            queryWrapper.eq(ObjectUtil.isNotEmpty(reportAssistHan.getPressure()), "pressure", reportAssistHan.getPressure());
            queryWrapper.eq(ObjectUtil.isNotEmpty(reportAssistHan.getTemp()), "temp", reportAssistHan.getTemp());
            queryWrapper.eq(ObjectUtil.isNotEmpty(reportAssistHan.getHan()), "han", reportAssistHan.getHan());
        }
        return reportAssistHanMapper.selectList(queryWrapper);
    }

    /**
     * 新增过热蒸汽焓值
     *
     * @param reportAssistHan 过热蒸汽焓值
     * @return 结果
     */
    @Override
    public int insertReportAssistHan(ReportAssistHan reportAssistHan) {
        return reportAssistHanMapper.insert(reportAssistHan);
    }

    /**
     * 修改过热蒸汽焓值
     *
     * @param reportAssistHan 过热蒸汽焓值
     * @return 结果
     */
    @Override
    public int updateReportAssistHan(ReportAssistHan reportAssistHan) {
        return reportAssistHanMapper.updateById(reportAssistHan);
    }

    /**
     * 删除过热蒸汽焓值
     *
     * @param id 过热蒸汽焓值ID
     * @return 结果
     */
    @Override
    public int deleteReportAssistHanById(Long id) {
        return reportAssistHanMapper.deleteById(id);
    }

    /**
     * 批量删除过热蒸汽焓值
     *
     * @param ids 过热蒸汽焓值ID
     * @return 结果
     */
    @Override
    public int deleteReportAssistHanByIds(Long[] ids) {
        if (ids.length == 0) return 0;
        return reportAssistHanMapper.deleteBatchIds(ListUtil.toList(ids));
    }
}
